home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 2 / Amiga Tools 2.iso / tex / macros / source / contrib / williams / toklist.sty < prev   
Text File  |  1995-03-09  |  1KB  |  26 lines

  1. % Impliment token list macros from pages 378-379 of "The TeXbook" by D.E. Knuth
  2. % ISBN 0-201-13448-9
  3.  
  4. \newtoks\TOKL@ta
  5. \newtoks\TOKL@tb
  6. \long\def\TOKL@prepend#1\to#2{\TOKL@ta={\\{#1}}\TOKL@tb=\expandafter{#2}%
  7.   \edef#2{\the\TOKL@ta\the\TOKL@tb}}
  8. \long\def\TOKL@prependv#1\to#2{\TOKL@ta={\\}\TOKL@tb=\expandafter{#2}%
  9.   \edef#2{\the\TOKL@ta{#1}\the\TOKL@tb}}
  10. \long\def\TOKL@append#1\to#2{\TOKL@ta={\\{#1}}\TOKL@tb=\expandafter{#2}%
  11.   \edef#2{\the\TOKL@tb\the\TOKL@ta}}
  12. \long\def\TOKL@appendv#1\to#2{\TOKL@ta={\\}\TOKL@tb=\expandafter{#2}%
  13.   \edef#2{\the\TOKL@tb\the\TOKL@ta{#1}}}
  14. \def\TOK@concat#1=#2{\TOK@ta=\expandafter{#2}\TOK@tb=\expandafter{#3}%
  15.   \edef#1{\the\TOKL@ta\the\TOKL@tb}}
  16.  
  17. \def\TOKL@lop#1\to#2{\expandafter\TOKL@lopoff#1\TOKL@lopoff#1#2}
  18. \long\def\TOKL@lopoff\\#1#2\TOKL@lopoff#3#4{\def#4{#1}\def#3{#2}}
  19.  
  20. \def\TOK@card#1\to#2{#2=0 \long\def\\##1{\advance#2 by 1 }#1}
  21.  
  22. \def\TOK@select#1\of#2\to#3{\def#3{\outofrange}%
  23.   \long\def\\##1{\advance#1-1 \ifnum#1=0 \def#3{##1}\fi}#2}
  24.  
  25. \def\TOK@empty#1{\ifx#1\empty true\else false\fi}
  26.